<div>
	<h2>Add Related Products</h2>
	<div class="content">
		<div class="form700">
			<? if (!isset($fatalError)): ?>
				<?= Phpr_Form::openTag(array('id'=>$this->listGetFormId(), 'class'=>'relative')) ?>
					<div class="formFlash"></div>

					<div class="embeddedList search700">
						<?
							$listColumns = array('name', 'sku', 'price');
						?>
					
						<?= $this->listRender(array(
							'list_model_class'=>'Shop_Product',
							'list_columns'=>$listColumns,
							'list_custom_body_cells'=>PATH_APP.'/phproad/modules/db/behaviors/db_listbehavior/partials/_list_body_cb.htm',
							'list_custom_head_cells'=>PATH_APP.'/phproad/modules/db/behaviors/db_listbehavior/partials/_list_head_cb.htm',
							'list_custom_prepare_func'=>'prepare_related_product_list',
							'list_record_url'=>null,
							'list_search_enabled' => true,
							'list_no_setup_link'=>true,
							'list_search_fields'=> array('@name', 'sku'),
							'list_search_prompt'=>'find products by name or SKU',
							'list_no_form'=>true,
							'list_top_partial'=>false,
							'list_name'=>'add_related_products_list',
							'list_items_per_page'=>10
						)) ?>
					</div>

					<?= backend_ajax_button('Add selected products', 'onAddRelatedProducts', array(), "
						loadIndicator: {show: true, hideOnSuccess: true, injectInElement: true},
						update: 'multi',
						onSuccess: updateRelatedList,
						onAfterUpdate: function(){
							realignPopups();
						}
					") ?>

					<?= backend_button('Close', array('onclick'=>'return cancelPopup()')) ?>
			
					<div class="clear"></div>
					<input type="hidden" name="edit_session_key" value="<?= h($edit_session_key) ?>"/>
					<input type="hidden" name="add_related_product_mode" value="1"/>
				</form>
			<? else: ?>
				<?= flash() ?>
				<?= backend_button('Cancel', array('onclick'=>'return cancelPopup()')) ?>
				<div class="clear"></div>
			<? endif ?>
		</div>
	</div>
</div>